package com.qs.core.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class ContextService implements ApplicationContextAware {
	
	private static ApplicationContext ctx;
	
	@Override
	public void setApplicationContext(ApplicationContext context)throws BeansException {
		ctx = context;
	}
	
	public static <T> T getBean(String name,Class<T> className){
		return ctx.getBean(name,className);
	}
	
	
}
